﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace School.WebPages.School
{
    public partial class TeacherList : System.Web.UI.Page
    {
        TechnologySchoolEntities db = new TechnologySchoolEntities();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                BindData();
            }
        }

        private void BindData()
        {
            var kj = db.Teachers.Where(t => t.Major == 0 && t.Position == 1).OrderBy(t => t.TOrder);
            rep_kj.DataSource = kj;
            rep_kj.DataBind();

            var gm = db.Teachers.Where(t => t.Major == 1 && t.Position == 1).OrderBy(t => t.TOrder);
            rep_gm.DataSource = gm;
            rep_gm.DataBind();

            var yx = db.Teachers.Where(t => t.Major == 2 && t.Position == 1).OrderBy(t => t.TOrder);
            rep_yx.DataSource = yx;
            rep_yx.DataBind();

            var gs = db.Teachers.Where(t => t.Major == 3 && t.Position == 1).OrderBy(t => t.TOrder);
            rep_gs.DataSource = gs;
            rep_gs.DataBind();
        }
    }
}
